<template>
  <a-table :row-selection="rowSelection" :columns="columns" :data-source="data">
    <a slot="name" slot-scope="text">{{ text }}</a>
    <span slot="name" slot-scope="name">
      <a-avatar icon="user" /> {{ name }}
    </span>
  </a-table>
</template>

<script>
export default {
  name: 'Table',
  props: ['data', 'columns'], // 组件传过来的参数
  data () {
    return {
    }
  },
  computed: {
    rowSelection () {
      return {
        onChange: (selectedRowKeys, selectedRows) => {
          console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.name === 'Disabled User', // Column configuration not to be checked
            name: record.name
          }
        })
      }
    }
  }
}

</script>

<style scoped>

</style>
